package com.jcl.recruit.elasticsearch.core.tools;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName Match

 * @Author yyliu
 * @Date 2018/11/2 17:21
 * @Version 1.0
 **/
public class Match {
    private Map<String, MatchObj> match = new HashMap<>();
    public Map<String, MatchObj> getMatch() {
        return match;
    }
    public void setMatch(String key, Object o) {
        this.match.put(key, mdObjMap(o, null));
    }
    public void setMatch(String key, Object o, String type) {
        this.match.put(key, mdObjMap(o, type));
    }
    private MatchObj mdObjMap(Object query, String type){
        MatchObj matchObj = new MatchObj();
        matchObj.setQuery(query);
        if(null == type){
            matchObj.setType(MatchObj.DEFAULT_TYPE);
        }
        return matchObj;
    }
}